package com.javaee.weixin.xiaochengxu.support;

import java.text.SimpleDateFormat;
import java.util.TimeZone;

import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.MapperFeature;
import com.fasterxml.jackson.databind.ObjectMapper;

/**
 * The Class CutObjectMapper.
 */
public class CutObjectMapper extends ObjectMapper {


	/**
	 * Instantiates a new cut object mapper.
	 */
	public CutObjectMapper() {
		super();
		// 除 map 外每个字段按字母顺序输出
		this.configure(MapperFeature.SORT_PROPERTIES_ALPHABETICALLY, true);
		// 默认的时间格式 （ISO-8601）
		this.setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"));
		// 忽略未知属性
		this.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
		// 默认的时区（东8区）
		this.setTimeZone(TimeZone.getTimeZone("GMT+8"));
	}
}
